const mongoose = require('mongoose')
const deptSchema = mongoose.Schema({
    deptName: String, //部门名称
    userId: String, //权限标识
    userName: String,
    userEmail: String,
    parentId: [mongoose.Types.ObjectId],
    // "createTime": {
    //     type: Date,
    //     default: Date.now()
    // }, //创建时间
    // "updateTime": {
    //     type: Date,
    //     default: Date.now()
    // }, //更新时间
}, {
    timestamps: { // 使用mongoose新增的内置时间戳记录
        createdAt: 'createTime',
        updatedAt: 'updateTime'
    }
})

module.exports = mongoose.model("dept", deptSchema, "depts")